package com.kx.kxpicture.exception;

/**
 * 异常工具类
 *
 * @author kuangxin
 * date 2025/8/13
 */
public class ThrowsUtils {
    /**
     * 条件成立则抛出异常
     * @author kuangxin
     * @date 2025/8/13
     */
    public static void throwIf(boolean condition, ErrorCode errorCode){
        if (condition){
            throw new BusinessException(errorCode);
        }
    }

    public static void throwIf(boolean condition, ErrorCode errorCode,String message){
        if (condition){
            throw new BusinessException(errorCode,message);
        }
    }

    public static void throwIf(boolean condition,RuntimeException runtimeException){
        if (condition){
            throw runtimeException;
        }
    }
}
